package com.bdqn.appjob.service.backend;

import java.util.List;

import javax.annotation.Resource;

import com.bdqn.appjob.dao.backend.BackAppInfoMapper;
import org.springframework.stereotype.Service;

import com.bdqn.appjob.entity.AppInfo;

@Service
public class BackAppInfoServiceImpl implements BackAppInfoService {
	@Resource
	private BackAppInfoMapper backappInfoMapper;

	@Override
	public Integer getCount(String softwareName,
			Integer flatformId, Integer categoryLevel1, Integer categoryLevel2, Integer categoryLevel3) {
		int num = 0;
		try {
			num = backappInfoMapper.getCount(softwareName, flatformId, categoryLevel1, categoryLevel2, categoryLevel3);
		} catch (Exception e) {
			e.printStackTrace();
		}
		return num;
	}

	@Override
	public List<AppInfo> getAllList(String softwareName, Integer flatformId, Integer categoryLevel1, Integer categoryLevel2,
			Integer categoryLevel3, Integer pageIndex, Integer pageSize) {
		List<AppInfo> list = null;
		try {
			list = backappInfoMapper.getAllList(softwareName,flatformId, categoryLevel1, categoryLevel2, categoryLevel3,
					pageIndex, pageSize);
		} catch (Exception e) {
			e.printStackTrace();
		}
		return list;
	}

	@Override
	public AppInfo getListId(Integer id) {
		AppInfo app = null;
		try {
			app = backappInfoMapper.getListId(id);
		} catch (Exception e) {
			e.printStackTrace();
		}
		return app;
	}

	@Override
	public boolean updStatus(Integer status, Integer id) {
		boolean flg = false;
		try {
			if(backappInfoMapper.updStatus(status, id) > 0){
				flg = true;
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
		return flg;
	}

}
